**************************************
*** Compensation vs. Protectionism *** 
**************************************

use "kimpelc_ad_taa.dta", clear

* Table 2: Substitution Between Trade Protection and Trade Compensation
 
eststo clear 
eststo: xtreg sum_ad_pc d_impusch_p9 d_czone_USexport all_petitions_wrks_pc_lag1 i.year , fe
eststo: xtreg sum_ad_pc d_impusch_p9 d_czone_USexport all_petitions_wrks_pc_lag3 i.year , fe
eststo: xtreg sum_ad_pc d_impusch_p9 d_czone_USexport all_petitions_wrks_pc_lag5 i.year , fe
eststo: xtreg sum_ad_pc d_impusch_p9 d_czone_USexport all_petitions_wrks_pc_lag1 rep_share_fill pop_female_perc pop_white_perc pop_black_perc pop_asian_perc pop_hispanic_perc  pop_age1-pop_age9   i.year , fe
eststo: xtreg sum_ad_pc d_impusch_p9 d_czone_USexport all_petitions_wrks_pc_lag3 rep_share_fill pop_female_perc pop_white_perc pop_black_perc pop_asian_perc pop_hispanic_perc  pop_age1-pop_age9   i.year , fe
eststo: xtreg sum_ad_pc d_impusch_p9 d_czone_USexport all_petitions_wrks_pc_lag5 rep_share_fill pop_female_perc pop_white_perc pop_black_perc pop_asian_perc pop_hispanic_perc  pop_age1-pop_age9   i.year , fe

esttab using "Table2.tex", label  keep(d_impusch_p9 d_czone_USexport all_petitions_wrks_pc_lag1 all_petitions_wrks_pc_lag3 all_petitions_wrks_pc_lag5 rep_share_fill pop_female_perc pop_white_perc pop_black_perc pop_asian_perc pop_hispanic_perc   ) indicate("Year FE = *2000*") se(5) b(5) replace star(+ 0.10 * 0.05 ** 0.01) compress nogaps nodepvars r2

* Table 3: Substitution Between Trade Protection and Trade Compensation: Certified vs. Rejected
 
eststo clear
eststo: xtreg sum_ad_pc d_impusch_p9  d_czone_USexport certified_petitions_wrks_pc_lag1  rejected_petitions_wrks_pc_lag1 rep_share_fill pop_female_perc pop_white_perc pop_black_perc pop_asian_perc pop_hispanic_perc  pop_age1-pop_age9   i.year , fe
eststo: xtreg sum_ad_pc d_impusch_p9  d_czone_USexport certified_petitions_wrks_pc_lag3  rejected_petitions_wrks_pc_lag3 rep_share_fill pop_female_perc pop_white_perc pop_black_perc pop_asian_perc pop_hispanic_perc  pop_age1-pop_age9   i.year , fe
eststo: xtreg sum_ad_pc d_impusch_p9  d_czone_USexport certified_petitions_wrks_pc_lag5  rejected_petitions_wrks_pc_lag5 rep_share_fill pop_female_perc pop_white_perc pop_black_perc pop_asian_perc pop_hispanic_perc  pop_age1-pop_age9   i.year , fe

esttab using "Table3.tex", label  keep(d_impusch_p9 d_czone_USexport certified_petitions_wrks_pc_lag1 certified_petitions_wrks_pc_lag3 certified_petitions_wrks_pc_lag5 rejected_petitions_wrks_pc_lag1 rejected_petitions_wrks_pc_lag3 rejected_petitions_wrks_pc_lag5  rep_share_fill pop_female_perc pop_white_perc pop_black_perc pop_asian_perc pop_hispanic_perc) order(d_impusch_p9 d_czone_USexport  certified_petitions_wrks_pc_lag1 rejected_petitions_wrks_pc_lag1 certified_petitions_wrks_pc_lag3 rejected_petitions_wrks_pc_lag3 certified_petitions_wrks_pc_lag5   rejected_petitions_wrks_pc_lag5  rep_share_fill pop_female_perc pop_white_perc pop_black_perc pop_asian_perc pop_hispanic_perc) indicate("Year FE = *2000*") se(5) b(5) replace star(+ 0.10 * 0.05 ** 0.01) compress nogaps nodepvars r2

* Table 4: Substitution Between Trade Protection and Trade Compensation: Steel Sector

eststo clear
eststo: xtreg sum_steel_ad_pc d_impusch_p9 d_czone_USexport L1st_all_petitions_wrks_cty_pc i.year , fe
eststo: xtreg sum_steel_ad_pc d_impusch_p9 d_czone_USexport L3st_all_petitions_wrks_cty_pc i.year , fe
eststo: xtreg sum_steel_ad_pc d_impusch_p9 d_czone_USexport L5st_all_petitions_wrks_cty_pc i.year , fe
eststo: xtreg sum_steel_ad_pc d_impusch_p9 d_czone_USexport L1st_all_petitions_wrks_cty_pc rep_share_fill pop_female_perc pop_white_perc pop_black_perc pop_asian_perc pop_hispanic_perc  pop_age1-pop_age9   i.year , fe
eststo: xtreg sum_steel_ad_pc d_impusch_p9 d_czone_USexport L3st_all_petitions_wrks_cty_pc rep_share_fill pop_female_perc pop_white_perc pop_black_perc pop_asian_perc pop_hispanic_perc  pop_age1-pop_age9   i.year , fe
eststo: xtreg sum_steel_ad_pc d_impusch_p9 d_czone_USexport L5st_all_petitions_wrks_cty_pc rep_share_fill pop_female_perc pop_white_perc pop_black_perc pop_asian_perc pop_hispanic_perc  pop_age1-pop_age9   i.year , fe

esttab using "Table4.tex", label  keep(d_impusch_p9 d_czone_USexport L1st_all_petitions_wrks_cty_pc L3st_all_petitions_wrks_cty_pc L5st_all_petitions_wrks_cty_pc rep_share_fill pop_female_perc pop_white_perc pop_black_perc pop_asian_perc pop_hispanic_perc   ) indicate("Year FE = *2000*") se(5) b(5) replace star(+ 0.10 * 0.05 ** 0.01) compress nogaps nodepvars r2


*************************
*** Electoral Effects *** 
*************************

use "kimpelc_ad_taa_election.dta", clear

* Table 5: TAA Effect on Incumbent Share (1992-2016)

eststo clear	

eststo: xtreg incumbent_share d_impusch_p9 i.year, fe
eststo: xtreg incumbent_share d_impusch_p9 all_taa_wrks_t4_lag_pc i.year, fe
eststo: xtreg incumbent_share d_impusch_p9 all_taa_wrks_t4_lag_pc pop_age1_perc pop_age2_perc pop_age3_perc pop_age4_perc pop_age5_perc pop_age6_perc pop_age7_perc pop_age8_perc pop_age9_perc pop_asian_perc pop_black_perc pop_change_perc pop_female_perc pop_hispanic_perc  pop_native_perc pop_white_perc i.year, fe
esttab using "Table5.tex",  label  keep(d_impusch_p9 all_taa_wrks_t4_lag_pc pop_asian_perc pop_black_perc pop_female_perc pop_hispanic_perc pop_native_perc pop_white_perc)  se(3) b(3) replace star(+ 0.10 * 0.05 ** 0.01) compress nogaps nodepvars indicate("Year FE = *2000*") r2

* Table 6: Effect on Incumbent Share (Dem vs. Rep Incumbent Years)

eststo clear	
eststo: xtreg incumbent_share d_impusch_p9 all_taa_wrks_t4_lag_pc i.year if incumbent_party_d==1, fe
eststo: xtreg incumbent_share d_impusch_p9 certified_taa_wrks_t4_lag_pc rejected_taa_wkrs_t4_lag_pc i.year if incumbent_party_d==1, fe
eststo: xtreg incumbent_share d_impusch_p9 all_taa_wrks_t4_lag_pc i.year if incumbent_party_d==0, fe
eststo: xtreg incumbent_share d_impusch_p9 certified_taa_wrks_t4_lag_pc rejected_taa_wkrs_t4_lag_pc i.year if incumbent_party_d==0, fe

esttab using "Table6.tex",  label  keep(d_impusch_p9 all_taa_wrks_t4_lag_pc certified_taa_wrks_t4_lag_pc rejected_taa_wkrs_t4_lag_pc)  se(3) b(3) replace star(+ 0.10 * 0.05 ** 0.01) compress nogaps nodepvars indicate("Year FE = *20*") r2

* Table 7: TAA Effect on Republican Vote Share (1992-2016)

eststo clear	

eststo: xtreg rep_share d_impusch_p9 all_taa_wrks_t4_lag_pc i.year, fe
eststo: xtreg rep_share d_impusch_p9 certified_taa_wrks_t4_lag_pc rejected_taa_wkrs_t4_lag_pc i.year, fe
eststo: xtreg rep_share d_impusch_p9 certified_taa_wrks_t4_lag_pc rejected_taa_wkrs_t4_lag_pc pop_age1_perc pop_age2_perc pop_age3_perc pop_age4_perc pop_age5_perc pop_age6_perc pop_age7_perc pop_age8_perc pop_age9_perc pop_asian_perc pop_black_perc pop_change_perc pop_female_perc pop_hispanic_perc  pop_native_perc pop_white_perc i.year, fe

esttab using "Table7.tex",  label  keep(d_impusch_p9 all_taa_wrks_t4_lag_pc certified_taa_wrks_t4_lag_pc rejected_taa_wkrs_t4_lag_pc pop_asian_perc pop_black_perc pop_female_perc pop_hispanic_perc pop_native_perc pop_white_perc)  se(3) b(3) replace star(+ 0.10 * 0.05 ** 0.01) compress nogaps nodepvars r2  indicate("Year FE = *20*") 


